<?php
global $e107shop_db_name, $shop_settings, $sql;

$sql = new db;
$sql->db_Select($e107shop_db_name['gateways'], "*", "identifier='ideal'");

while ($row=$sql->db_Fetch()) {
    $ideal_id  = $row['account'];
    $ideal_url = $row['field1'];
    $ideal_key = $row['field2'];
}

switch (e_LANGUAGE) {
    case "Dutch":
        $language = "nl_NL";
        break;
    default:
        $language = "en_US";
}

$orderid = e107shop_order_id();
$total = $total * 100;
$sha1string = sha1($orderid . $total . $currency . $ideal_id . $ideal_key);

$temp .= "   
<form action='$ideal_url' method='post' id='form1' name='form1'>
<input type='hidden' name='PSPID' value='$ideal_id'>
<input type='hidden' name='orderID' value='$orderid'>
<input type='hidden' name='amount' value='$total'>
<input type='hidden' name='currency' value='$currency'>
<input type='hidden' name='language' value='$language'>
<input type='hidden' name='TITLE' value='".$shop_settings["store_name"]."'>
<input type='hidden' name='BGCOLOR' value='#FFFFFF'> 
<input type='hidden' name='TXTCOLOR' value='blue'> 
<input type='hidden' name='TBLBGCOLOR' value='#FFFFFF'> 
<input type='hidden' name='TBLTXTCOLOR' value='#000000'> 
<input type='hidden' name='BUTTONBGCOLOR' value=''> 
<input type='hidden' name='BUTTONTXTCOLOR' value='blue'> 
<input type='hidden' name='FONTTYPE' value='Verdana'>
<input type='hidden' name='LOGO' value=''> 
<input type='hidden' name='TP' value=''>
<input type='hidden' name='accepturl' value='".$shop_settings['path']."payment_accepted.php'>
<input type='hidden' name='declineurl' value='".$shop_settings['path']."payment_error.php'>
<input type='hidden' name='exceptionurl' value='".$shop_settings['path']."payment_error.php'>
<input type='hidden' name='cancelurl' value='".$shop_settings['path']."payment_canceled.php'>
<input type='hidden' name='homeurl' value='".$shop_settings['path']."'>
<input type='hidden' name='catalogurl' value=''>
<input type='hidden' name='CN' value='$fname $lname'>
<input type='hidden' name='EMAIL' value='$email'>
<input type='hidden' name='PM' value=''>
<input type='hidden' name='BRAND' value=''>
<input type='hidden' name='ownerZIP' value=''>
<input type='hidden' name='owneraddress' value=''>
<input type='hidden' name='SHASign' value='$sha1string'>
<input type='hidden' name='Alias' value=''>
<input type='hidden' name='AliasUsage' value=''>
<input type='hidden' name='AliasOperation' value=''>
<input type='hidden' name='COM' value=''>
<input type='hidden' name='COMPLUS' value=''>
<input type='hidden' name='PARAMPLUS' value=''>
<input type='hidden' name='USERID' value=''>";

if ($language == "nl_NL") {
    $temp .= "<input type='submit' value='Ik wil nu betalen' id='submit2' name='submit2'></form>";
} else {
    $temp .= "<input type='submit' value='I want to pay now' id='submit2' name='submit2'></form>";
}

e107shop_process_order($orderid, "pending", $cart_id, "ideal", $region, $coupon);
$total = $total / 100;
return $temp;
